<div>
    <div ng-if="!vm.hasPermissionCategory">
        您无权访问此页面！
    </div>
    <div ng-if="vm.hasPermissionCategory">
        <span style="display:inline-block;">
            <div ng-click="vm.mode='add';vm.currentCategory={};" style="background:{{vm.mode=='add'?'green':'transparent'}}">新建</div>
            <div ng-repeat="category in vm.categories" ng-click="vm.setCurrentCategory(category);vm.mode='edit';" style="background:{{vm.currentCategory==category?'green':'transparent'}}">
                {{category.id}},{{category.name}}<p/>
            </div>
        </span>
        <span style="position:absolute;margin-left:5em;">
            <div ng-show="vm.currentCategory != undefined">
                {{vm.currentCategory}}<p/>
                <input type="text" ng-model="vm.currentCategory.name">
                <a class="btn btn-default" ng-click="vm.saveEdit();">保存</a>
                <a ng-show="vm.mode=='edit'" class="btn btn-default" ng-click="vm.remove();">删除</a>
                <p/>
                <span ng-show="vm.currentCategory.image!=undefined">
                    <img style="width:30%;" ng-src="{{vm.currentCategory.image.url}}" >
                    <a class="btn btn-default" ng-click="vm.removeImage();">删除</a>
                </span>

                <div ng-show="vm.mode=='edit'">
                    <ng-include src="'/template/component/UploadFile.html'"></ng-include>
                    <a class="btn btn-default" ng-click="vm.setImage()">添加</a>
                </div>
            </div>
        </span>
    </div>
</div>